home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / fireEffect.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  38.4 KB  |  1,169 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  July, 1998
  22. //  Author:         Carol Levy; based on a fire scene created by Matt Baer
  23. //
  24. //  Description:
  25. //      This script contains code to create a fire effect for Maya FX.
  26. //        It does so by creating an emitter, setting appropriate attributes
  27. //        for the emitter and the emitted particles (the fire), and creating 
  28. //        a turbulence field, a drag field, and a gravity field to control the
  29. //        direction of the fire.  It sets appropriate parameters for the attributes
  30. //        of the various objects.  This script also creates attributes on the fire
  31. //        particle to control the main attributes of the fire, and creates expressions
  32. //        to connect them to the corresponding attributes on the emitters and fields,
  33. //        e.g.  "fireDensity" is connected to the emitter rate and "fireSpeed" is
  34. //        connected to the gravity field's magnitude.  These fire particle attributes
  35. //        are created to make it easier for the user to control the major parameters of
  36. //        the fire in a more intuitive way, without having to search among the various
  37. //        fields and emitter for the attributes that will give control over the
  38. //        desired effect.  In addition this scrip creates the necessary shaders and
  39. //        textures, and sets appropriate parameters for them.
  40. //
  41. //        Note:  This script creates the mechanisms for software rendering only.
  42. //
  43. //    Procedures:
  44. //
  45. //        These first two procedures are called externally to create the fire effect.
  46. //        fireEffect() must be called first.
  47. //
  48. //        fireEffect                        Create all objects and expressions. Make all
  49. //                                        connections.
  50. //        fireEffectSetFireAttributes        Set main attribute values.  In interactive mode,
  51. //                                        these come from the option box.
  52. //        findRamp                        Find and return the name of a ramp of the
  53. //                                        specified type.
  54. //        createFireParticle                Create the fire particle.
  55. //        createFireEmitter                Create the emitter of the fire particles.
  56. //        createFireAttributes            Create the dynamic attributes of the fire
  57. //                                        particle.
  58. //        createGravityField                Create gravity field and its expressions.
  59. //        createTurbulenceField            Create turbuelence field and its expressions.
  60. //        createFireParticleCloudShader    Create the fire particle's particle cloud
  61. //                                        shader and set some attributes.
  62. //        createFireShaderRamps            Create the shader ramps for the fire color,
  63. //                                        transparency, incandescence.
  64. //        createFireCraterBlobMap            Create the blob map for the fire particle.
  65. //        createFireRadiusRamp            Create a ramp for the fire radiusPP.
  66. //        
  67. //
  68. //  ====================== findRamp ======================
  69. //
  70. //  SYNOPSIS
  71. //        Find the array mapper or ramp node  of the specified type that is
  72. //        connected to the specified particle shape.
  73. //
  74. //  INPUT ARGUMENTS
  75. //        string $particleShape    Particle shape whose ramp we are looking for
  76. //        string $type            Type of ramp or array mapper.
  77. //
  78. //
  79. proc string findRamp(string $particleShape, string $type)
  80. {
  81.     string $ramps[] = `listConnections -source true $particleShape`;
  82.     if ($type == "ramp")
  83.         $ramps = `listConnections -source true ($ramps[0] + ".computeNode")`;
  84.  
  85.     return $ramps[0];
  86. }
  87.  
  88.  
  89. //  ====================== fireEffect ======================
  90. //
  91. //  SYNOPSIS
  92. //      Create a Fire clip effect.
  93. //
  94. //  INPUT ARGUMENTS
  95. //
  96. //        string $fireParticleName    Name the user specified, if any.
  97. //        string $fireObj                The object to be on fire, if any. The emitter
  98. //                                    and the turbulence field will be owned by it.
  99. //        string $emitterType            Type of emitter to be created.
  100. //
  101. //  Return Value:
  102. //      string $fireParticleName = The name of the new particle.
  103. //
  104. global proc string fireEffect(string $fireParticleName,
  105.                                     string $fireObj,
  106.                                     string $emitterType)
  107. {
  108.     if( `licenseCheck -type complete` == 0 )
  109.     {
  110.         warning("You are not licensed to use the Fire Effect.");
  111.         return "";
  112.     }
  113.  
  114.     // Not to start on too pessimistic a note, but save all objects created so
  115.     // far, so they can be deleted if we have to abort.
  116.     //
  117.     string $objectsCreated[];
  118.     int $objectsCreatedIndex = 0;
  119.  
  120.     string $fireObject;
  121.  
  122.     string $emitter = "";
  123.     string $fire = "";
  124.     string $fireShape = "";
  125.     string $gravity = "";
  126.     string $turbulence = "";
  127.     string $drag = "";
  128.     string $particleCloudShader = "";
  129.  
  130.     int $componentsSelected = 0;
  131.     string $selectedList[];
  132.  
  133.     if (size($fireObj) == 0)
  134.     {
  135.         // If the user did not specify an object, check the selected list.
  136.         //
  137.         $selectedList = `ls -sl`;
  138.  
  139.         // If the user did not specify an object, then if the emitter type
  140.         // is a surface or a curve, there is an error, because they must
  141.         // be added to a surface/curve object.
  142.         //
  143.         if ((size($selectedList) == 0) &&
  144.             ($emitterType == "surface" || $emitterType == "curve"))
  145.         {
  146.             warning($emitterType + " emitters must be owned by a " + $emitterType + " object.  Name or select an object to own the emitter and try again.");
  147.             return "";
  148.         }
  149.         
  150.         // If the user selected more than one object, there is an error, as the
  151.         // fire can be added to only one object at a time.  But it the selection list
  152.         // consists of components of the selected object, then accept it.
  153.         //
  154.         if (size($selectedList) > 1)
  155.         {
  156.             string $selectedObjects[] = `ls -sl -o`;
  157.  
  158.             if (size($selectedObjects) > 1)
  159.             {
  160.                 warning("The fire effect can only be added to one fire object at a time.  Name or select only one object.");
  161.                 return "";
  162.             }
  163.             else
  164.             {
  165.                 $componentsSelected = 1;
  166.             }
  167.         }
  168.  
  169.         // Note, it is possible that there will be no fire object, e.g. the
  170.         // user is creating a positional emitter to emit fire.
  171.     }
  172.     else 
  173.     {
  174.         // The user sent name of fire object, so, below, we need to use the
  175.         // selection list, so add $fireObj to the list.
  176.         //
  177.         $selectedList[0] = $fireObj;
  178.     }
  179.  
  180.     string $resultNames[];
  181.  
  182.     // Create the fire particle.
  183.     //
  184.     $resultNames = createFireParticle($fireParticleName);
  185.  
  186.     if (size($resultNames) == 0)
  187.     {
  188.         warning("Unable to create fire particle. Aborting creation of fire effect.");
  189.         return "";
  190.     }
  191.  
  192.     $fire = $resultNames[0];
  193.     $fireShape = $resultNames[1];
  194.  
  195.     $objectsCreated[$objectsCreatedIndex] = $fire;
  196.     $objectsCreatedIndex++;
  197.  
  198.     // First, we need to reestablish the selection list, so the turbulence field will be
  199.     // added to the fire object or fire object components, or if there was nothing
  200.     // selected or named as fire object, zero out the selection list so a positional
  201.     // emitter will be created.
  202.     //
  203.     reSelectOriginalList($selectedList);
  204.  
  205.     // Create the emitter that will emit the fire particle, set its default fire
  206.     // parameters, and create an expression to control its rate, spread  and
  207.     // direction from the fire dynamic attributes "fireDensity," "fireSpread" and
  208.     // "fireDirection".
  209.     // 
  210.     $emitter = createFireEmitter($fireShape, $emitterType);
  211.  
  212.     if (size($emitter) == 0)
  213.     {
  214.         warning("Unable to create fire emitter. Aborting creation of fire effect.");
  215.         cleanupObjects($objectsCreated);
  216.         return "";
  217.     }
  218.  
  219.     $objectsCreated[$objectsCreatedIndex] = $emitter;
  220.     $objectsCreatedIndex++;
  221.  
  222.     // Connect the emitter to the fire particle.  The emitter thus emits
  223.     // the fire.
  224.     //
  225.     connectDynamic -em $emitter $fireShape;
  226.  
  227.     // Create the turbulence field and create an expression to have its "phase"
  228.     // attribute increase over time and to connect its "magnitude" to the particle
  229.     // shape's "fireTurbulence" attribute.
  230.     //
  231.     // First, we need to reestablish the selection list, so the turbulence field will be
  232.     // added to the fire object or fire object components, or if there was nothing
  233.     // selected or named as fire object, zero out the selection list so a positional
  234.     // emitter will be created.
  235.     //
  236.     reSelectOriginalList($selectedList);
  237.  
  238.     $turbulence = createTurbulenceField($fireShape);
  239.  
  240.     if (size($turbulence) == 0)
  241.     {
  242.         warning("Unable to create fire turbulence field. Aborting creation of fire effect.");
  243.         cleanupObjects($objectsCreated);
  244.         return "";
  245.     }
  246.  
  247.     $objectsCreated[$objectsCreatedIndex] = $turbulence;
  248.     $objectsCreatedIndex++;
  249.  
  250.     // If there is no fire object, then parent the turbulence field to the point emitter.
  251.     //
  252.     if (size($selectedList) == 0)
  253.         parent $turbulence $emitter;
  254.  
  255.     // Create a positional drag field, that will be used to keep the fire
  256.     // from getting out of control.
  257.     //
  258.     $resultNames = `drag -pos 0 0 0 -magnitude 10`;
  259.  
  260.     if (size($resultNames) == 0)
  261.     {
  262.         warning("Unable to create fire drag field. Aborting creation of fire effect.");
  263.         cleanupObjects($objectsCreated);
  264.         return "";
  265.     }
  266.  
  267.     $drag = $resultNames[0];
  268.  
  269.     $objectsCreated[$objectsCreatedIndex] = $drag;
  270.     $objectsCreatedIndex++;
  271.  
  272.     // Create the gravity field, and connect its "magnitude" to the fire particle's
  273.     // "fireSpeed" and its direction the fire particle's "fireDirection".
  274.     //
  275.     $gravity = createGravityField($fireShape);
  276.  
  277.     if (size($gravity) == 0)
  278.     {
  279.         warning("Unable to create fire gravity field. Aborting creation of fire effect.");
  280.         cleanupObjects($objectsCreated);
  281.         return "";
  282.     }
  283.  
  284.     $objectsCreated[$objectsCreatedIndex] = $gravity;
  285.     $objectsCreatedIndex++;
  286.  
  287.     // Connect the turbulence, gravity and drag fields to the fire particle.
  288.     //
  289.     connectDynamic -f $turbulence -f $drag  -f $gravity $fireShape;
  290.  
  291.     // Create a particle cloud shader, set some of the attributes, and connect
  292.     // it to the fire particle.
  293.     //
  294.     $particleCloudShader = createFireParticleCloudShader($fireShape);
  295.  
  296.     if (size($particleCloudShader) == 0)
  297.     {
  298.         warning("Unable to create fire shader. Aborting creation of fire effect.");
  299.         cleanupObjects($objectsCreated);
  300.         return "";
  301.     }
  302.  
  303.     $objectsCreated[$objectsCreatedIndex] = $particleCloudShader;
  304.     $objectsCreatedIndex++;
  305.  
  306.     // Create the color, transparency and incandescence ramps for the fire
  307.     // particle and set some of their attributes.
  308.     // Return the names of the ramps and placement maps that have been created.
  309.     //
  310.     string $texObjs[];
  311.  
  312.     // If there is an error in creating the ramps, since I can't return both the
  313.     // names of the ramps already created and an error signal, I will just delete
  314.     // any ramps already created in the proc and return an empty array.
  315.     //
  316.     $texObjs = createFireShaderRamps($particleCloudShader);
  317.  
  318.     if (size($texObjs) == 0)
  319.     {
  320.         warning("Unable to create fire shader ramps. Aborting creation of fire effect.");
  321.         cleanupObjects($objectsCreated);
  322.         return "";
  323.     }
  324.  
  325.     // Add the ramps and texture placement maps to the objectsCreated array.
  326.     //
  327.     int $texObjsIndex = 0;
  328.     int $endIndex = $objectsCreatedIndex + size($texObjs);
  329.  
  330.     for ($objectsCreatedIndex; $objectsCreatedIndex < $endIndex; $objectsCreatedIndex++)
  331.     {
  332.         $objectsCreated[$objectsCreatedIndex] = $texObjs[$texObjsIndex];
  333.         $texObjsIndex++;
  334.     }
  335.     clear($texObjs);
  336.  
  337.     // Create a crater 3D blob map texture for the fire shader and set some
  338.     // of its attributes.
  339.     //
  340.     $texObjs = createFireCraterBlobMap($particleCloudShader, $fireShape);
  341.  
  342.     if (size($texObjs) == 0)
  343.     {
  344.         warning("Unable to create fire blob map. Aborting creation of fire effect.");
  345.         cleanupObjects($objectsCreated);
  346.         return "";
  347.     }
  348.  
  349.     // Add the blob texture and texture placement map to the objectsCreated array.
  350.     //
  351.     $texObjsIndex = 0;
  352.     $endIndex = $objectsCreatedIndex + size($texObjs);
  353.  
  354.     for ($objectsCreatedIndex; $objectsCreatedIndex < $endIndex; $objectsCreatedIndex++)
  355.     {
  356.         $objectsCreated[$objectsCreatedIndex] = $texObjs[$texObjsIndex];
  357.         $texObjsIndex++;
  358.     }
  359.     clear($texObjs);
  360.  
  361.     // Make a ramp for the radiusPP of the fire particle and set some of its
  362.     // attributes. 
  363.     //
  364.     string $fireRadiusRamp = createFireRadiusRamp($fireShape);
  365.  
  366.     if (size($fireRadiusRamp) == 0)
  367.     {
  368.         warning("Unable to create fire radiusPP ramp. Aborting creation of fire effect.");
  369.         cleanupObjects($objectsCreated);
  370.         return "";
  371.     }
  372.  
  373.     // Make the fire particle the selected object.
  374.     //
  375.     select -r $fireShape;
  376.  
  377.     return $fireShape;
  378. }
  379.  
  380.  
  381. //  ====================== createFireAttributes ======================
  382. //
  383. //  SYNOPSIS
  384. //        Create the dynamic attributes on the particle shape that will be the primary
  385. //        way to control the fire parameters.  They will be connected to the appropriate
  386. //        attributes of the emitter and fields:
  387. //            fireSpeed            --> gravity magnitude
  388. //            fireDirection<XYZ>    --> gravity direction and emitter direction
  389. //            fireSpread            -->    emitter spread
  390. //            fireTurbulence        --> turbulence magnitude
  391. //            fireDensity            --> emitter rate
  392. //            fireIntensity        --> particle cloud shader glowIntensity
  393. //            fireScale            --> particle lifespanPP, gravity magnitude, 
  394. //                                    emitter rate, turbulence phase, 
  395. //                                    turbulence magnitude
  396. //
  397. //  INPUT ARGUMENTS
  398. //
  399. //        string $fire         fire particle name
  400. //        string $fireShape    fire particle shape name
  401. //
  402. //
  403. global proc createFireAttributes(string $fire, string $fireShape)
  404. {
  405.     select -r $fireShape;
  406.  
  407.     // Set lifespan mode to per-particle.
  408.     //
  409.     setAttr ($fireShape+".lifespanMode") 3;
  410.  
  411.     addAttr -ln radiusPP -dt doubleArray $fireShape;
  412.     addAttr -ln radiusPP0 -dt doubleArray $fireShape;
  413.     addAttr -ln radiusPPCache -dt doubleArray $fireShape;
  414.  
  415.     addAttr -ln "ageNormalized" -dt "doubleArray";
  416.  
  417.     // Add attributes to control fire parameters.  These are added to make it
  418.     // easier for a user to control the fire in terms of desired effect,
  419.     // rather than through setting individual attributes on a variety of
  420.     // objects (fields and emitter).
  421.     //
  422.     addAttr -ln fireScale -at double -min 0  -dv 1 $fireShape;
  423.     addAttr -ln fireSpeed -at double -min 0 -dv 85 $fireShape;
  424.     addAttr -ln fireDirectionX -at double -min -100  -dv 0 $fireShape;
  425.     addAttr -ln fireDirectionY -at double -min -100  -dv 1 $fireShape;
  426.     addAttr -ln fireDirectionZ -at double -min -100  -dv 0 $fireShape;
  427.     addAttr -ln fireSpread -at double -min 0 -max 1 -dv 85 $fireShape;
  428.     addAttr -ln fireTurbulence -at double -min 0  -dv 240 $fireShape;
  429.     addAttr -ln fireDensity -at double -min 0 -dv 25 $fireShape;
  430.     addAttr -ln flameStartRadius -at double -min 0  -dv 1.0 $fireShape;
  431.     addAttr -ln flameEndRadius -at double -min 0  -dv .4 $fireShape;
  432.     addAttr -ln fireIntensity -at double -min 0 -max 1 -dv .5 $fireShape;
  433.     addAttr -ln fireLifespan -at double -min 0 -dv 1 $fireShape;
  434.  
  435.     setAttr -keyable on ($fireShape + ".fireScale");
  436.     setAttr -keyable on ($fireShape + ".fireSpeed");
  437.     setAttr -keyable on ($fireShape + ".fireDirectionX");
  438.     setAttr -keyable on ($fireShape + ".fireDirectionY");
  439.     setAttr -keyable on ($fireShape + ".fireDirectionZ");
  440.     setAttr -keyable on ($fireShape + ".fireSpread");
  441.     setAttr -keyable on ($fireShape + ".fireIntensity");
  442.     setAttr -keyable on ($fireShape + ".fireLifespan");
  443.     setAttr -keyable on ($fireShape + ".fireTurbulence");
  444.     setAttr -keyable on ($fireShape + ".fireDensity");
  445.     setAttr -keyable on ($fireShape + ".flameStartRadius");
  446.     setAttr -keyable on ($fireShape + ".flameEndRadius");
  447.  
  448.     // Set the fire particle render type to software cloud, and add the relevant
  449.     // attributes.
  450.     //
  451.     setAttr ($fireShape + ".particleRenderType") 8;
  452.  
  453.     addAttr -is true -ln "betterIllumination" 
  454.             -at bool -dv false $fireShape;
  455.     addAttr -is true -ln "surfaceShading" 
  456.             -at "float" -min 0 -max 1 -dv 0 $fireShape;
  457.     addAttr -is true -ln "threshold" 
  458.             -at "float" -min 0 -max 1 -dv 0 $fireShape;
  459.     addAttr -is true -ln "radius" 
  460.             -at "float" -min 0 -max 20 -dv 1 $fireShape;
  461.  
  462.     // Make an expression for particle lifespanPP.
  463.     //
  464.     $exprString = "float $myphase = -3*time;\n" + $fireShape + ".lifespanPP = (dnoise(" + $fireShape + ".position * .5 * " + $fireShape + ".fireScale + $myphase) + .1) * fireLifespan";
  465.  
  466.     dynExpression -s $exprString -c -n ($fire + "FireLifespanExpr") $fireShape;
  467. }
  468.  
  469.  
  470. //  ====================== createFireParticle ======================
  471. //
  472. //  SYNOPSIS
  473. //        Create the fire particle object. And create its dynamic attributes.
  474. //
  475. //  INPUT ARGUMENTS
  476. //        string $fireParticleName    the fire particle's name (may be blank)
  477. //
  478. global proc string[] createFireParticle(string $fireParticleName)
  479. {
  480.     // [0] will be the particle name; [1] will be the particle shape name.
  481.     //
  482.     string $resultNames[];
  483.  
  484.     if (size($fireParticleName) > 0)
  485.         $resultNames = `particle -n $fireParticleName`;
  486.     else
  487.         $resultNames = `particle`;
  488.  
  489.     if (size($resultNames) == 0)
  490.         return $resultNames;
  491.  
  492.     // Create and set the fire particle's dynamic attributes.
  493.     //
  494.     createFireAttributes($resultNames[0], $resultNames[1]);
  495.  
  496.     return $resultNames;
  497. }
  498.  
  499. //  ====================== createFireEmitter ======================
  500. //
  501. //  SYNOPSIS
  502. //        Create the emitter that will emit the fire particles, set its main default
  503. //        parameters, and create an expression to connect its rate to the fire's 
  504. //        "fireDensity" and "fireScale" attributes, its spread to the fire's
  505. //        "fireSpread,  and its direction to the fire's "fireDirection" attributes.
  506. //
  507. //  INPUT ARGUMENTS
  508. //        string $fireShape    the fire particle shape name
  509. //
  510. global proc string createFireEmitter(string $fireShape, string $emitterType)
  511. {
  512.     // Create the emitter and let it get the default name.  Because we have selected
  513.     // the fire object, if there is one, the emitter will be added to it.
  514.     //
  515.     string $resultNames[];
  516.     string $emitter;
  517.  
  518.     $resultNames = `emitter 
  519.         -type $emitterType -dx 0 -dy 1 -dz 0 -rate 10 -speed 1`;
  520.  
  521.     if (size($resultNames) == 0)
  522.         return "";
  523.  
  524.     // If the emitter is positional, its name will be the only one in the
  525.     // result string.  If it was added to an object, it will be the second
  526.     // name in the result string.
  527.     //
  528.     if (size($resultNames) == 1)
  529.         $emitter = $resultNames[0];
  530.     else
  531.         $emitter = $resultNames[1];
  532.  
  533.     // Add an expression to set the emitter "rate" to the fire particle's "fireDensity",
  534.     // the emitter "spread" to the fire particle's "fireSpread", and the emitter
  535.     // "direction" to the fire particle's "direction".
  536.     //
  537.     expression -s 
  538.         ("rate = " + $fireShape + ".fireDensity * " + $fireShape + ".fireScale;\n" + 
  539.          "spread = " + $fireShape + ".fireSpread;\n" +
  540.          "directionX = " + $fireShape + ".fireDirectionX;\n" +
  541.          "directionY = " + $fireShape + ".fireDirectionY;\n" + 
  542.          "directionZ = " + $fireShape + ".fireDirectionZ;") 
  543.         -o $emitter
  544.         -n ($emitter + "FireExpr");
  545.  
  546.     return $emitter;
  547. }
  548.  
  549.  
  550. //  ====================== createGravityField ======================
  551. //
  552. //  SYNOPSIS
  553. //        Create the gravity field, set its main default parameters, and create an
  554. //        expression to connect its magnitude to the fire's "fireSpeed" and
  555. //        "fireScale" attributes, and its direction to the fire's "fireDirection"
  556. //        attributes.
  557. //
  558. //  INPUT ARGUMENTS
  559. //        string $fireShape    the fire particle shape name
  560. //
  561. //
  562. global proc    string createGravityField(string $fireShape)
  563. {
  564.     int $failed;
  565.  
  566.     string $resultNames[];
  567.  
  568.     // catch returns 1 if command failed.
  569.     //
  570.     $failed = catch($resultNames = `gravity -pos 0 0 0 
  571.                             -magnitude 85 
  572.                             -directionX 0 -directionY 1 -directionZ 0`);
  573.  
  574.     if ($failed || size($resultNames) == 0)
  575.         return "";
  576.  
  577.     string $gravity = $resultNames[0];
  578.  
  579.     // Make an expression to connect the fireSpeed attribute to the
  580.     // gravity magnitude, and the fireDirection attribute to the gravity direction.
  581.     //
  582.     expression -s 
  583.         ("magnitude = " + $fireShape + ".fireSpeed * " + $fireShape + ".fireScale;\n"+
  584.          "directionX = " + $fireShape + ".fireDirectionX;\n" +
  585.          "directionY = " + $fireShape + ".fireDirectionY;\n" +
  586.          "directionZ = " + $fireShape + ".fireDirectionZ;")
  587.         -name ($gravity + "FireExpr") 
  588.         -o $gravity;
  589.  
  590.     return $gravity;
  591. }
  592.  
  593.  
  594. //  ====================== createTurbulenceField ======================
  595. //
  596. //  SYNOPSIS
  597. //        Create the turbulence field, set its main default parameters, and create an
  598. //        expression to connect its magnitude to the fire's "fireTurbulence" and
  599. //        "fireScale" attributes, and and expression for its phase.
  600. //
  601. //
  602. //  INPUT ARGUMENTS
  603. //        string $fireShape    the fire particle shape name
  604. //
  605. //
  606. global proc string  createTurbulenceField(string $fireShape)
  607. {
  608.     int $failed;
  609.     string $resultNames[];
  610.     
  611.     // catch returns 1 if command failed.
  612.     //
  613.     $failed = catch( $resultNames= `turbulence 
  614.                                         -magnitude 240 
  615.                                         -attenuation 1.0 
  616.                                         -frequency 1.1`);
  617.  
  618.     if ($failed || size($resultNames) == 0)
  619.         return "";
  620.  
  621.     string $turbulence;
  622.  
  623.     // If the turbulence field is a positional, the name will be the only one
  624.     // in the list, otherwise it will be the second item in the list.
  625.     //
  626.     if (size($resultNames) == 1)
  627.         $turbulence = $resultNames[0];
  628.     else
  629.         $turbulence = $resultNames[1];
  630.  
  631.     // Add an expression to make the phase of the turbulence increase with
  632.     // time.  This will keep the fire from emitting/moving in too uniform
  633.     // a manner.  Also connect the magnitude to the particle's "fireTurbulence"
  634.     // attribute.
  635.     //
  636.     expression -s ("phaseZ = time * 3 * " + $fireShape + ".fireScale;\n" +
  637.                    "magnitude = " + $fireShape + ".fireTurbulence * " + $fireShape + ".fireScale;") 
  638.         -o $turbulence
  639.         -n ($turbulence + "FireExpr");
  640.  
  641.     return $turbulence;
  642. }
  643.  
  644.  
  645. //  ====================== createFireParticleCloudShader ======================
  646. //
  647. //  SYNOPSIS
  648. //        Create the particle cloud shader for the fire particle and set some of its
  649. //        attributes to reasonable default values for the fire appearance.  Connect
  650. //        the shader to the fire particle shape.  Create an expression to connect
  651. //        the shader's "glowIntensity" attribute to the fire particle's "fireIntensity"
  652. //        attribute.
  653. //
  654. //  INPUT ARGUMENTS
  655. //        string $fireShape    the fire particle shape name
  656. //
  657. //
  658. global proc string createFireParticleCloudShader(string $fireShape)
  659. {
  660.      string $particleCloudShader;
  661.      
  662.      // catch returns 1 if command failed.
  663.  
  664.      int $failed = catch( $particleCloudShader = `shadingNode -asShader particleCloud`);
  665.   
  666.      if ($failed || size($particleCloudShader) == 0)
  667.          return "";
  668.   
  669.       string $particleCloudShaderSG = $particleCloudShader + "SG";
  670.   
  671.       sets -renderable true -noSurfaceShader true -empty -name $particleCloudShaderSG;
  672.   
  673.       connectAttr -f ($particleCloudShader + ".outColor") ($particleCloudShaderSG + ".volumeShader");
  674.  
  675.       setAttr ($particleCloudShader + ".density") 3.002;
  676.       setAttr ($particleCloudShader + ".noiseFreq") 0.5041;
  677.       setAttr ($particleCloudShader + ".noiseAspect") -0.6748;
  678.  
  679.      //  Connect the particle cloud shader to the fire particle shape.
  680.      //
  681.      sets -e -forceElement $particleCloudShaderSG $fireShape;
  682.   
  683.      // Set this transparency attribute to total transparency, as we are going
  684.      // to add a transparency map to the particle cloud shader.
  685.      //
  686.      setAttr ($particleCloudShader + ".transparency") -type double3 1 1 1 ;
  687.   
  688.      // Connect glowIntensity to be driven by the fires's fireIntensity attribute.
  689.      //
  690.      expression -s ("glowIntensity = " + $fireShape + ".fireIntensity;")
  691.          -o $particleCloudShader
  692.          -n ($particleCloudShader + "FireIntensityExpr");
  693.  
  694.     return $particleCloudShader;
  695. }
  696.  
  697.  
  698. //  ====================== createFireShaderRamps ======================
  699. //
  700. //  SYNOPSIS
  701. //        Create color, transparency and incandescence ramps for the fire, make the
  702. //        necessary connections, and set their main default parameters.
  703. //
  704. //
  705. //  INPUT ARGUMENTS
  706. //        string $particleCloudShader    name of the particle cloud shader to connect
  707. //                                    the ramps to.
  708. //
  709. //
  710. global proc string[] createFireShaderRamps(string $particleCloudShader)
  711. {
  712.  
  713.      int $failed;
  714.  
  715.      // Create a string array to return all created objects.
  716.      //
  717.      string $ramps[];
  718.      int $rampIndex = 0;
  719.  
  720.      string $colorRamp;
  721.      string $colorPlaceTex;
  722.      string $ageMapper;
  723.  
  724.      // Create a color ramp and particle age mapper for the fire, and make the
  725.      // necessary connections.
  726.      //
  727.      $failed = catch($colorRamp = `shadingNode -asTexture ramp`);
  728.  
  729.      if ($failed || size($colorRamp) == 0)
  730.      {
  731.          clear($ramps);
  732.          return $ramps;
  733.      }
  734.  
  735.      $ramps[$rampIndex] = $colorRamp;
  736.      $rampIndex++;
  737.  
  738.      $failed = catch($colorPlaceTex = `shadingNode -asUtility place2dTexture`);
  739.  
  740.      if ($failed || size($colorPlaceTex) == 0)
  741.      {
  742.          cleanupObjects($ramps);
  743.          clear($ramps);
  744.          return $ramps;
  745.      }
  746.  
  747.      $ramps[$rampIndex] = $colorPlaceTex;
  748.      $rampIndex++;
  749.  
  750.      $failed = catch($ageMapper = `shadingNode -at -asUtility particleAgeMapper`);
  751.  
  752.      if ($failed || size($ageMapper) == 0)
  753.      {
  754.          cleanupObjects($ramps);
  755.          clear($ramps);
  756.          return $ramps;
  757.      }
  758.  
  759.      $ramps[$rampIndex] = $ageMapper;
  760.      $rampIndex++;
  761.  
  762.      //connectAttr place2dTexture1.outUV ($colorRamp + ".uv");
  763.      //connectAttr place2dTexture1.outUvFilterSize ($colorRamp + ".uvFilterSize");
  764.  
  765.      connectAttr ($colorPlaceTex+".outUV") ($colorRamp + ".uv");
  766.      connectAttr ($colorPlaceTex+".outUvFilterSize") ($colorRamp + ".uvFilterSize");
  767.      connectAttr -f ($ageMapper + ".outUvCoord") ($colorPlaceTex + ".uvCoord");
  768.      connectAttr -f ($colorRamp + ".outColor") ($particleCloudShader + ".color");
  769.  
  770.      // Activate relativeAge.
  771.      //
  772.      setAttr ($ageMapper + ".relativeAge") 1;
  773.  
  774.      // Set color and position attributes of the color ramp for fire.
  775.      //
  776.      setAttr ($colorRamp + ".colorEntryList[0].color") 
  777.               -type double3 0.574 0.274 0.148 ;
  778.      setAttr ($colorRamp + ".colorEntryList[0].position") 1.0;
  779.  
  780.      setAttr ($colorRamp + ".colorEntryList[1].color") 
  781.               -type double3 0.675 0.439 0.143 ;    
  782.      setAttr ($colorRamp + ".colorEntryList[1].position") 0.425;
  783.  
  784.      setAttr ($colorRamp +  ".colorEntryList[2].color") 
  785.               -type double3 0.739 0.559 0.172;
  786.      setAttr ($colorRamp + ".colorEntryList[2].position") 0.0;
  787.  
  788.      // Create a transparency ramp for the fire, and make the necessary connections.
  789.      //
  790.      string $transparencyRamp;
  791.      string $transPlaceTex;
  792.      
  793.      $failed = catch($transparencyRamp = `shadingNode -asTexture ramp`);
  794.  
  795.      if ($failed || size($transparencyRamp) == 0)
  796.      {
  797.          cleanupObjects($ramps);
  798.          clear($ramps);
  799.          return $ramps;
  800.      }
  801.  
  802.      $ramps[$rampIndex] = $transparencyRamp;
  803.      $rampIndex++;
  804.  
  805.      $failed = catch($transPlaceTex = `shadingNode -asUtility place2dTexture`);
  806.  
  807.      if ($failed || size($transPlaceTex) == 0)
  808.      {
  809.          cleanupObjects($ramps);
  810.          clear($ramps);
  811.          return $ramps;
  812.      }
  813.  
  814.      $ramps[$rampIndex] = $transPlaceTex;
  815.      $rampIndex++;
  816.  
  817.      connectAttr ($transPlaceTex + ".outUV") ($transparencyRamp + ".uv");
  818.      connectAttr ($transPlaceTex + ".outUvFilterSize") ($transparencyRamp + ".uvFilterSize");
  819.      connectAttr -f ($ageMapper + ".outUvCoord") ($transPlaceTex + ".uvCoord");
  820.      connectAttr -f ($transparencyRamp + ".outColor") ($particleCloudShader + ".transparency");
  821.  
  822.      // Set color and position attributes of the transparency ramp for fire.
  823.      //
  824.      setAttr ($transparencyRamp + ".colorEntryList[0].color") 
  825.              -type double3 1 1 1 ;
  826.      setAttr ($transparencyRamp + ".colorEntryList[0].position") 1.0;
  827.  
  828.      setAttr ($transparencyRamp + ".colorEntryList[1].color") 
  829.              -type double3 .9 .9 .9 ;
  830.      setAttr ($transparencyRamp + ".colorEntryList[1].position") .48;
  831.  
  832.      setAttr ($transparencyRamp + ".colorEntryList[2].color") 
  833.              -type double3 1 1 1 ;
  834.      setAttr ($transparencyRamp + ".colorEntryList[2].position") 0;
  835.  
  836.  
  837.      // Create an incandescence ramp for the fire, and make the necessary connections.
  838.      //
  839.      string $incanRamp;
  840.      string $incanPlaceTex;
  841.      
  842.      $failed = catch($incanRamp = `shadingNode -asTexture ramp`);
  843.  
  844.      if ($failed || size($incanRamp) == 0)
  845.      {
  846.          cleanupObjects($ramps);
  847.          clear($ramps);
  848.          return $ramps;
  849.      }
  850.  
  851.      $ramps[$rampIndex] = $incanRamp;
  852.      $rampIndex++;
  853.  
  854.      $failed = catch($incanPlaceTex = `shadingNode -asUtility place2dTexture`);
  855.  
  856.      if ($failed || size($incanPlaceTex) == 0)
  857.      {
  858.          cleanupObjects($ramps);
  859.          clear($ramps);
  860.          return $ramps;
  861.      }
  862.  
  863.      $ramps[$rampIndex] = $incanPlaceTex;
  864.      $rampIndex++;
  865.  
  866.      connectAttr ($incanPlaceTex + ".outUV") ($incanRamp + ".uv");
  867.      connectAttr ($incanPlaceTex + ".outUvFilterSize") ($incanRamp + ".uvFilterSize");
  868.      connectAttr -f ($ageMapper + ".outUvCoord") ($incanPlaceTex + ".uvCoord");
  869.      connectAttr -f ($incanRamp + ".outColor") ($particleCloudShader + ".incandescence");
  870.  
  871.      // Set color and position attributes of the incandescence ramp for fire.
  872.      //
  873.      setAttr ($incanRamp + ".colorEntryList[0].color") -type double3 0 0 0 ;
  874.      setAttr ($incanRamp + ".colorEntryList[0].position") 1.0;
  875.  
  876.      setAttr ($incanRamp + ".colorEntryList[1].color") 
  877.              -type double3 .11 .084 .011 ;
  878.      setAttr ($incanRamp + ".colorEntryList[1].position") .855;
  879.  
  880.      setAttr ($incanRamp + ".colorEntryList[2].color") 
  881.              -type double3 .756 .575 .078 ;
  882.      setAttr ($incanRamp + ".colorEntryList[2].position") .6;
  883.  
  884.      setAttr ($incanRamp + ".colorEntryList[3].color") 
  885.              -type double3 .712 .439 .184 ;
  886.      setAttr ($incanRamp + ".colorEntryList[3].position") .405;
  887.  
  888.      setAttr ($incanRamp + ".colorEntryList[4].color") -type double3 0 0 0 ;
  889.      setAttr ($incanRamp + ".colorEntryList[4].position") 0;
  890.  
  891.      return $ramps;
  892. }
  893.  
  894.  
  895. //  ====================== createFireCraterBlobMap ======================
  896. //
  897. //  SYNOPSIS
  898. //        Create a blob map for the fire using the crater texture, make the
  899. //        necessary connections, and set its main default parameters.
  900. //
  901. //  INPUT ARGUMENTS
  902. //        string $fireShape    the fire particle shape name
  903. //
  904. //
  905. global proc string[] createFireCraterBlobMap(string $particleCloudShader, 
  906.                                                 string $fireShape)
  907. {
  908.     int $failed;
  909.  
  910.     // Create the texture and make the connections.
  911.     //
  912.      string $craterTex;
  913.     string $craterPlaceTex;
  914.  
  915.     string $craterObjs[];
  916.     
  917.     $failed = catch($craterTex = `shadingNode -asTexture crater`);
  918.  
  919.     if ($failed || size($craterTex) == 0)
  920.     {
  921.         clear($craterObjs);
  922.         return $craterObjs;
  923.     }
  924.  
  925.     $craterObjs[0] = $craterTex;
  926.  
  927.      $failed = catch($craterPlaceTex = `shadingNode -asUtility place3dTexture`);
  928.  
  929.     if ($failed || size($craterPlaceTex) == 0)
  930.     {
  931.         cleanupObjects($craterObjs);
  932.         clear($craterObjs);
  933.         return $craterObjs;
  934.     }
  935.  
  936.     $craterObjs[1] = $craterPlaceTex;
  937.  
  938.  
  939.      connectAttr ($craterPlaceTex + ".wim[0]") ($craterTex + ".pm");
  940.     connectAttr -f ($craterTex + ".outColor") ($particleCloudShader + ".blobMap");
  941.  
  942.     // Set some default values for some of the attributes.
  943.     //
  944.      setAttr ($craterTex + ".shaker") 14.417;
  945.      setAttr ($craterTex + ".channel1") -type double3 1 0.681 0.329 ;
  946.      setAttr ($craterTex + ".channel2") -type double3 0.251 0.137 0.086 ;
  947.      setAttr ($craterTex + ".channel3") -type double3 0.219 0.129 0.043 ;
  948.      setAttr ($craterTex + ".melt") 0.05;
  949.      setAttr ($craterTex + ".balance") 0.5691;
  950.      setAttr ($craterTex + ".frequency") 0.732;
  951.  
  952.     setAttr ($craterPlaceTex + ".scaleX") 2;
  953.     setAttr ($craterPlaceTex + ".scaleY") 5;
  954.     setAttr ($craterPlaceTex + ".scaleZ") 2;
  955.     setAttr ($craterPlaceTex + ".inheritsTransform") 0;
  956.  
  957.     // Create an expression to make the crater placement rise over time.  This
  958.     // will help keep the texture from being too "fixed" and creating a too
  959.     // uniform and still image of the fire.
  960.     //
  961.     string $textureExpr = "";
  962.     $textureExpr += "vector $fireDirection = <<"+$fireShape+".fireDirectionX,"+$fireShape+".fireDirectionY,"+$fireShape+".fireDirectionZ>>;\n";
  963.     $textureExpr += "$fireDirection = unit( $fireDirection );\n";
  964.     $textureExpr += "float $timeScale = time * 0.07 * "+$fireShape+".fireSpeed * "+$fireShape+".fireScale;\n";
  965.     $textureExpr += "translateX = $fireDirection.x * $timeScale;\n";
  966.     $textureExpr += "translateY = $fireDirection.y * $timeScale;\n";
  967.     $textureExpr += "translateZ = $fireDirection.z * $timeScale;\n";
  968.     expression -s $textureExpr
  969.         -name ($craterPlaceTex + "FireExpr") 
  970.         -o $craterPlaceTex;
  971.  
  972.     //
  973.     // Create two locators that will be used to orient the
  974.     // scaled texture placement node in the "fireDirection".
  975.     //
  976.     string $fireDirectionLocator[] = `spaceLocator`;
  977.     rename $fireDirectionLocator[0] ($fireShape+"_fireDirection");
  978.     $fireDirectionLocator = `ls -sl`;
  979.     setAttr ".inheritsTransform" 0;
  980.     connectAttr ($fireShape+".fireDirectionX") ($fireDirectionLocator[0]+".translateX");
  981.     connectAttr ($fireShape+".fireDirectionY") ($fireDirectionLocator[0]+".translateY");
  982.     connectAttr ($fireShape+".fireDirectionZ") ($fireDirectionLocator[0]+".translateZ");
  983.     setAttr -lock 1 ".translateX";
  984.     setAttr -lock 1 ".translateY";
  985.     setAttr -lock 1 ".translateZ";
  986.     $craterObjs[2] = $fireDirectionLocator[0];
  987.  
  988.     string $fireOrientationLocator[] = `spaceLocator`;
  989.     rename $fireOrientationLocator[0] ($fireShape+"_fireOrientation");
  990.     $fireOrientationLocator = `ls -sl`;
  991.     setAttr ".inheritsTransform" 0;
  992.     setAttr -lock 1 ".translateX";
  993.     setAttr -lock 1 ".translateY";
  994.     setAttr -lock 1 ".translateZ";
  995.     $craterObjs[3] = $fireOrientationLocator[0];
  996.  
  997.     aimConstraint -weight 1 -aimVector 0 1 0 -upVector 0 1 0 -worldUpType "vector"
  998.         -worldUpVector 0 1 0 $fireDirectionLocator[0] $fireOrientationLocator[0];
  999.  
  1000.     connectAttr ($fireOrientationLocator[0]+".rotate") ($craterPlaceTex+".rotate");
  1001.  
  1002.     group $craterPlaceTex $fireDirectionLocator $fireOrientationLocator;
  1003.     string $textureGroup[] = `ls -sl`;
  1004.     $craterObjs[4] = $textureGroup[0];
  1005.  
  1006.     // Hide the crater placement map and the locators.
  1007.     //
  1008.     hide $textureGroup[0];
  1009.  
  1010.     return $craterObjs;
  1011. }
  1012.  
  1013.  
  1014. //  ====================== createFireRadiusRamp ======================
  1015. //
  1016. //  SYNOPSIS
  1017. //        Create a ramp for the radiusPP of the fire and set parameters, so the
  1018. //        radius will reduce over time, so as the fire rises, the flames will get 
  1019. //        smaller.  The radius will also be varied among the particles by the noise and
  1020. //        noise frequency.  Connect the fire particle's flameStartRadius to position 1
  1021. //        value and flameEndRadius to position 2 value of the ramp.
  1022. //
  1023. //  INPUT ARGUMENTS
  1024. //        string $fireShape    the fire particle shape name
  1025. //
  1026. //
  1027. global proc    string createFireRadiusRamp(string $fireShape)
  1028. {
  1029.     int $failed = catch(`arrayMapper -target $fireShape -destAttr radiusPP 
  1030.             -inputV ageNormalized -type ramp`);
  1031.  
  1032.     if ($failed)
  1033.         return "";
  1034.  
  1035.     string $fireRadiusRamp = 
  1036.                 findRamp(($fireShape + ".radiusPP"), "ramp");
  1037.  
  1038.     if (size($fireRadiusRamp) == 0)
  1039.         return "";
  1040.  
  1041.     // Start the flame at 0 radius and quickly rise to 1 so the flames won't
  1042.     // pop on; then taper off as the flame ages.  
  1043.     //
  1044.     setAttr ($fireRadiusRamp + ".colorEntryList[0].color") -type double3 0 0 0 ;
  1045.     setAttr ($fireRadiusRamp + ".colorEntryList[0].position") 0.00;
  1046.     setAttr ($fireRadiusRamp + ".colorEntryList[1].color") -type double3 1 1 1 ;
  1047.     setAttr ($fireRadiusRamp + ".colorEntryList[1].position") 0.1;
  1048.     setAttr ($fireRadiusRamp + ".colorEntryList[2].color") -type double3 0.4 0.4 0.4 ;
  1049.     setAttr ($fireRadiusRamp + ".colorEntryList[2].position") 1.00;
  1050.     setAttr ($fireRadiusRamp + ".noise") 0.0244;
  1051.     setAttr ($fireRadiusRamp + ".noiseFreq") 0.6342;
  1052.  
  1053.     // Create an expression to connect the fire particle's flameStartRadius to position 1
  1054.     // value and flameEndRadius to position 2 value of the ramp.
  1055.     //
  1056.      expression -s ("float $startRadius = " + $fireShape + ".flameStartRadius * " + $fireShape + ".fireScale;\n" +
  1057.                      "float $endRadius = " + $fireShape + ".flameEndRadius * " + $fireShape + ".fireScale;\n" +
  1058.                     "colorEntryList[1].colorR =  $startRadius;\n" +
  1059.                     "colorEntryList[1].colorG =  $startRadius;\n" + 
  1060.                     "colorEntryList[1].colorB =  $startRadius;\n" +
  1061.                     "colorEntryList[2].colorR =  $endRadius;\n" +
  1062.                     "colorEntryList[2].colorG =  $endRadius;\n" + 
  1063.                     "colorEntryList[2].colorB =  $endRadius;\n") 
  1064.          -o $fireRadiusRamp
  1065.          -n ($fireRadiusRamp + "FlameRadiusExpr");
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.     return $fireRadiusRamp;
  1072. }
  1073.  
  1074.  
  1075. //  ====================== reSelectOriginalList ======================
  1076. //
  1077. //  SYNOPSIS
  1078. //        Replace current selection list with the original list, which will be the
  1079. //        objects in the selection list when fireEffect() was invoked, or the fire
  1080. //        object named in its arg list.
  1081. //
  1082. //  INPUT ARGUMENTS
  1083. //        selectedList[]    the original selection list (or the fire object sent into
  1084. //                                                     fireEffect in the arg list)
  1085. //
  1086. //
  1087. global proc    reSelectOriginalList(string $selectedList[])
  1088. {
  1089.     if (size($selectedList) == 0)
  1090.     {
  1091.         select -cl;
  1092.     }
  1093.     else if (size($selectedList) == 1)
  1094.     {
  1095.         select -r $selectedList[0];
  1096.     }
  1097.     else
  1098.     {
  1099.         int $i;
  1100.         select -cl;
  1101.         for ($i = 0; $i <  size($selectedList); $i++)
  1102.             select -add $selectedList[$i];
  1103.     }
  1104. }
  1105.  
  1106.  
  1107. //  ====================== fireEffectSetFireAttributes ======================
  1108. //
  1109. //  SYNOPSIS
  1110. //        Set the fire attributes.  This allows the attributes to be other than the
  1111. //        defaults at creation time.  In interactive mode, these can be set in the
  1112. //        option box.
  1113. //
  1114. //  INPUT ARGUMENTS
  1115. //
  1116. //
  1117. global proc fireEffectSetFireAttributes( 
  1118.                                     string $fireParticleName,
  1119.                                     float $fireScale, 
  1120.                                     float $fireDensity, 
  1121.                                     float $fireStartRadius, 
  1122.                                     float $fireEndRadius, 
  1123.                                     float $fireIntensity, 
  1124.                                     float $fireSpeed,
  1125.                                     float $fireDirectionX,
  1126.                                     float $fireDirectionY,
  1127.                                     float $fireDirectionZ,
  1128.                                     float $fireSpread,
  1129.                                     float $turbulence)
  1130.                                     
  1131. {
  1132.     if( `licenseCheck -type complete` == 0 )
  1133.     {
  1134.         warning("You are not licensed to use the Fire Effect.");
  1135.         return;
  1136.     }
  1137.  
  1138.     if (objExists($fireParticleName))
  1139.     {
  1140.         setAttr ($fireParticleName + ".fireScale") $fireScale;
  1141.         setAttr ($fireParticleName + ".fireDensity") $fireDensity;
  1142.         setAttr ($fireParticleName + ".flameStartRadius") $fireStartRadius;
  1143.         setAttr ($fireParticleName + ".flameEndRadius") $fireEndRadius;
  1144.         setAttr ($fireParticleName + ".fireIntensity") $fireIntensity;
  1145.         setAttr ($fireParticleName + ".fireSpeed") $fireSpeed;
  1146.         setAttr ($fireParticleName + ".fireDirectionX") $fireDirectionX;
  1147.         setAttr ($fireParticleName + ".fireDirectionY") $fireDirectionY;
  1148.         setAttr ($fireParticleName + ".fireDirectionZ") $fireDirectionZ;
  1149.         setAttr ($fireParticleName + ".fireSpread") $fireSpread;
  1150.         setAttr ($fireParticleName + ".fireTurbulence") $turbulence;
  1151.  
  1152.     }
  1153.     else
  1154.     {
  1155.         warning($fireParticleName + " does not exist.");
  1156.     }
  1157. }
  1158.  
  1159.  
  1160. proc cleanupObjects(string $objects[])
  1161. {
  1162.     int $i;
  1163.     for ($i = 0; $i < size($objects); $i++)
  1164.     {
  1165.         if (size($objects[$i]) && objExists($objects[$i]))
  1166.             delete $objects[$i];
  1167.     }
  1168. }
  1169.